<layout name="layout"/>
<div class="main-div">
    <?php var_dump($data) ?>
    <br/>
    <?php var_dump($id) ?>
    <form name="main_form" method="POST" action="__SELF__">
        <table cellspacing="1" cellpadding="3" width="100%">
            <tr>
                <td class="label">上级分类：</td>
                <td>
                    <select name="parent_id">
                        <option value="0">顶级分类</option>
                        <?php foreach($data as $k=>$v): ?>
                        <?php   if($id==$v['id'] || in_array($v['id'],$childs))
                                    continue;
                               if ($id==$v['parent_id'])
                                      $select = 'selected="selected"';
                    			else{
                    				$select = '';
                    			}
                         ?>
                        <option
                        <?php echo $select ; ?>
                        value="<?php echo $v['id']; ?>
                        "><?php echo str_repeat('-', 8*$v['level']).$v['cat_name']; ?>
                        </option>
                        <?php endforeach; ?>
                    </select>
                </td>
            </tr>
            <tr>
                <td class="label">分类名称：</td>
                <td>
                    <input type="text" name="cat_name" value=""/>
                </td>
            </tr>
            <tr>
                <td colspan="99" align="center">
                    <input type="submit" class="button" value=" 确定 "/>
                    <input type="reset" class="button" value=" 重置 "/>
                </td>
            </tr>
        </table>
    </form>
</div>


<script>
</script>